Optimal. Leaf size=96 \[ -\frac {(A+3 i B) c^2 x}{a}-\frac {(i A-3 B) c^2 \log (\cos (e+f x))}{a f}-\frac {2 (A+i B) c^2}{a f (i-\tan (e+f x))}+\frac {i B c^2 \tan (e+f x)}{a f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.11, antiderivative size = 96, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 41, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.049, Rules used = {3669, 78}
\begin {gather*} -\frac {2 c^2 (A+i B)}{a f (-\tan (e+f x)+i)}-\frac {c^2 (-3 B+i A) \log (\cos (e+f x))}{a f}-\frac {c^2 x (A+3 i B)}{a}+\frac {i B c^2 \tan (e+f x)}{a f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 78
Rule 3669
Rubi steps
\begin {align*} \int \frac {(A+B \tan (e+f x)) (c-i c \tan (e+f x))^2}{a+i a \tan (e+f x)} \, dx &=\frac {(a c) \text {Subst}\left (\int \frac {(A+B x) (c-i c x)}{(a+i a x)^2} \, dx,x,\tan (e+f x)\right )}{f}\\ &=\frac {(a c) \text {Subst}\left (\int \left (\frac {i B c}{a^2}-\frac {2 (A+i B) c}{a^2 (-i+x)^2}+\frac {i (A+3 i B) c}{a^2 (-i+x)}\right ) \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac {(A+3 i B) c^2 x}{a}-\frac {(i A-3 B) c^2 \log (\cos (e+f x))}{a f}-\frac {2 (A+i B) c^2}{a f (i-\tan (e+f x))}+\frac {i B c^2 \tan (e+f x)}{a f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 1.75, size = 184, normalized size = 1.92 \begin {gather*} \frac {c^2 (\cos (f x)+i \sin (f x)) \left (-2 (A+3 i B) \text {ArcTan}(\tan (f x)) (\cos (e)+i \sin (e))+(-i A+3 B) \log \left (\cos ^2(e+f x)\right ) (\cos (e)+i \sin (e))+2 (A+i B) \cos (2 f x) (i \cos (e)+\sin (e))+2 (A+i B) (\cos (e)-i \sin (e)) \sin (2 f x)-2 B \sec (e+f x) \sin (f x) (-i+\tan (e))\right ) (A+B \tan (e+f x))}{2 f (A \cos (e+f x)+B \sin (e+f x)) (a+i a \tan (e+f x))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.23, size = 62, normalized size = 0.65
method | result | size |
derivativedivides | \(\frac {c^{2} \left (i B \tan \left (f x +e \right )-\frac {-2 i B -2 A}{-i+\tan \left (f x +e \right )}+\left (i A -3 B \right ) \ln \left (-i+\tan \left (f x +e \right )\right )\right )}{f a}\) | \(62\) |
default | \(\frac {c^{2} \left (i B \tan \left (f x +e \right )-\frac {-2 i B -2 A}{-i+\tan \left (f x +e \right )}+\left (i A -3 B \right ) \ln \left (-i+\tan \left (f x +e \right )\right )\right )}{f a}\) | \(62\) |
norman | \(\frac {\frac {\left (3 i c^{2} B +2 A \,c^{2}\right ) \tan \left (f x +e \right )}{a f}+\frac {i c^{2} B \left (\tan ^{3}\left (f x +e \right )\right )}{a f}-\frac {\left (3 i c^{2} B +A \,c^{2}\right ) x}{a}-\frac {-2 i A \,c^{2}+2 B \,c^{2}}{a f}-\frac {\left (3 i c^{2} B +A \,c^{2}\right ) x \left (\tan ^{2}\left (f x +e \right )\right )}{a}}{1+\tan ^{2}\left (f x +e \right )}-\frac {\left (-i A \,c^{2}+3 B \,c^{2}\right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 a f}\) | \(165\) |
risch | \(-\frac {c^{2} {\mathrm e}^{-2 i \left (f x +e \right )} B}{a f}+\frac {i c^{2} {\mathrm e}^{-2 i \left (f x +e \right )} A}{a f}-\frac {6 i c^{2} B x}{a}-\frac {2 c^{2} A x}{a}-\frac {6 i c^{2} B e}{a f}-\frac {2 c^{2} A e}{a f}-\frac {2 c^{2} B}{f a \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}+\frac {3 c^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) B}{a f}-\frac {i c^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) A}{a f}\) | \(167\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: RuntimeError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.47, size = 160, normalized size = 1.67 \begin {gather*} -\frac {2 \, {\left (A + 3 i \, B\right )} c^{2} f x e^{\left (4 i \, f x + 4 i \, e\right )} - {\left (i \, A - B\right )} c^{2} + {\left (2 \, {\left (A + 3 i \, B\right )} c^{2} f x - {\left (i \, A - 3 \, B\right )} c^{2}\right )} e^{\left (2 i \, f x + 2 i \, e\right )} - {\left ({\left (-i \, A + 3 \, B\right )} c^{2} e^{\left (4 i \, f x + 4 i \, e\right )} + {\left (-i \, A + 3 \, B\right )} c^{2} e^{\left (2 i \, f x + 2 i \, e\right )}\right )} \log \left (e^{\left (2 i \, f x + 2 i \, e\right )} + 1\right )}{a f e^{\left (4 i \, f x + 4 i \, e\right )} + a f e^{\left (2 i \, f x + 2 i \, e\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A]
time = 0.38, size = 194, normalized size = 2.02 \begin {gather*} - \frac {2 B c^{2}}{a f e^{2 i e} e^{2 i f x} + a f} + \begin {cases} \frac {\left (i A c^{2} - B c^{2}\right ) e^{- 2 i e} e^{- 2 i f x}}{a f} & \text {for}\: a f e^{2 i e} \neq 0 \\x \left (- \frac {- 2 A c^{2} - 6 i B c^{2}}{a} + \frac {\left (- 2 A c^{2} e^{2 i e} + 2 A c^{2} - 6 i B c^{2} e^{2 i e} + 2 i B c^{2}\right ) e^{- 2 i e}}{a}\right ) & \text {otherwise} \end {cases} - \frac {i c^{2} \left (A + 3 i B\right ) \log {\left (e^{2 i f x} + e^{- 2 i e} \right )}}{a f} + \frac {x \left (- 2 A c^{2} - 6 i B c^{2}\right )}{a} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Both result and optimal contain complex but leaf count of result is larger than twice
the leaf count of optimal. 283 vs. \(2 (87) = 174\).
time = 0.64, size = 283, normalized size = 2.95 \begin {gather*} \frac {\frac {{\left (-i \, A c^{2} + 3 \, B c^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 1\right )}{a} + \frac {2 \, {\left (i \, A c^{2} - 3 \, B c^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}{a} - \frac {{\left (i \, A c^{2} - 3 \, B c^{2}\right )} \log \left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 1\right )}{a} - \frac {-i \, A c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 3 \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 i \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + i \, A c^{2} - 3 \, B c^{2}}{{\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 1\right )} a} - \frac {3 i \, A c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} - 9 \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 10 \, A c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + 22 i \, B c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 3 i \, A c^{2} + 9 \, B c^{2}}{a {\left (\tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - i\right )}^{2}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 8.57, size = 110, normalized size = 1.15 \begin {gather*} \frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-\frac {3\,B\,c^2}{a}+\frac {A\,c^2\,1{}\mathrm {i}}{a}\right )}{f}+\frac {\frac {\left (A\,c^2-B\,c^2\,1{}\mathrm {i}\right )\,1{}\mathrm {i}}{a}+\frac {\left (A\,c^2+B\,c^2\,3{}\mathrm {i}\right )\,1{}\mathrm {i}}{a}}{f\,\left (1+\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}\right )}+\frac {B\,c^2\,\mathrm {tan}\left (e+f\,x\right )\,1{}\mathrm {i}}{a\,f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________